
import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";

//查询申请列表
export function applyList(data){
    return fetch ({
        url:`${baseUrl}ug/exchanges/applyList`,
        method:'post',
        data
    })
}

//新增申请列表
export function addApply(data){
    return fetch({
        url:`${baseUrl}ug/exchanges/apply`,
        method:'post',
        data
    })
}
//保存申请
export function saveApply(data){
    return fetch({
        url:`${baseUrl}ug/exchanges/save`,
        method:'post',
        data
    })
}

//课程计划表模板下载
export function downloadTemplate(){
    window.location.href = `${baseUrl}ug/exchanges/downloadTemplate`
}

//交流返校申请
export function back(ids){
    return fetch ({
        url:`${baseUrl}ug/exchanges/back?ids=${ids}`,
        method:'get'
    })
}

// 交流申请撤
export function exchangeRecall(workflowNo) {
    return fetch({
        url: `${baseUrl}ug/exchanges/recall?no=${workflowNo}`,
        method: 'get'
    })
}

// 交流查询页面交流证明下载
export function certificateDownload(data) {
    return fetch({
        url: `${baseUrl}ug/exchanges/pdf`,
        method: 'POST',
        responseType: 'blob',
        data
    }).then(res => {
        UTILS.downloadFile(res, '交流证明', 'application/pdf;charset=utf-8');
    });
}

export function queryApplyInfoById(params) {
    return fetch({
        url: `${baseUrl}ug/exchanges/queryApplyInfoById`,
        method: 'get',
        params
    })
}

